from typing import List

input = [1,2,3]

def permutation(nums):
    res = []
    path = []

    _permutation(nums, res, path)

    return res

def _permutation(nums: List[int], res, path):
    if not nums:
        res.append(path.copy())
        return
    for i in nums:
        left = nums.copy()
        left.remove(i)
        path.append(i)
        _permutation(left, res, path)
        path.pop()

print(permutation(input))